hisi_182x_sources = files(
  'hi182x_abi.cpp',
  'hi182x_card.cpp',
  'hi182x_om.cpp',
  'hi182x_port.cpp',
) + interface_sources

include_dirs += include_directories('../../../chip')
include_dirs += include_directories('../../../internal')

libhisi_182x_static = static_library(
  'hisi_182x',
  hisi_182x_sources,
  include_directories: include_dirs + hisi_interface_inc,
  dependencies: [dev_deps, libncsi_over_mctp_dep, libmctp_dep, libimu_dep, libsmbus_dep],
  install: false,
)

libhisi_182x = shared_library(
  'hisi_182x',
  include_directories: include_dirs + hisi_interface_inc,
  name_prefix: 'lib',
  name_suffix: 'so',
  install: true,
  install_dir: drivers_install_dir,
  link_whole: [libhisi_182x_static],
)
if build_tests
  hisi_182x_dep = declare_dependency(
    include_directories: include_dirs + hisi_interface_inc,
    link_with: libhisi_182x_static,
    dependencies: [
      libmcpp_deps,
      libncsi_over_mctp_dep,
      libmctp_dep,
      libimu_dep,
      libsmbus_dep,
    ],
  )
endif
if build_tests and meson_build
  custom_target(
    'copy_libhisi_182x',
    output: 'copy_libhisi_182x',
    command: ['cp', libhisi_182x.full_path(), drivers_install_dir],
    depends: libhisi_182x,
    build_by_default: true,
  )
endif